﻿
var numPanel = 0;
var winNo=0;
function addWindowFit(title, url, callback) {
    numPanel = numPanel + 20;
    var dicStr = "<div class='window" + numPanel + "'></div>";
    $('body').append(dicStr);
    $('.window' + numPanel).window({
        title: title,
        draggable: true,
        shadow: false,
        modal: true,
        collapsible: true,
        minimizable: false,
        maximizable: false,
        resizable: true,
        closable: true,
        fit: true,
        maximized: false,
        content: '<iframe id="iframe_"' + numPanel + ' scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:100%;"></iframe>',
        onClose: function() {
            if (callback != undefined) {
                callback();
            }
        }
    });
}

function addWindow_WH(title, url, width, height, fun) {
    numPanel = numPanel + 20;
    var dicStr = "<div class='window" + numPanel + "'></div>";
    $('body').append(dicStr);
    $('.window' + numPanel).window({
        title: title,
        draggable: false,
        shadow: false,
        modal: true,
        collapsible: true,
        minimizable: false,
        maximizable: false,
        resizable: true,
        closable: true,
        fit: false,
        maximized: false,
        width: width,
        height: height,
        content: '<iframe id="iframe_"' + numPanel + ' scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:100%;"></iframe>',
        onClose: function() {
            if (fun != undefined) {
                fun.apply(arguments);
            }
        }
    });
}

function getNumPanel()
{
    return numPanel;
}

function addWindowForRepositoryType(title, url, width, height) {
    numPanel = numPanel + 20;
    var dicStr = "<div class='window" + numPanel + "'></div>";
    $('body').append(dicStr);
    $('.window' + numPanel).window({
        title: title,
        draggable: true,
        shadow: false,
        modal: true,
        collapsible: true,
        minimizable: false,
        maximizable: false,
        resizable: true,
        closable: true,
        fit: false,
        maximized: false,
        width: width,
        height: height,
        content: '<iframe id="iframe_"' + numPanel + ' scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:100%;"></iframe>',
        onClose: function() {
        }
    });
}

function refresh(winNo) {
    if(eval("top.selectedWin"+winNo)){
    //top.selectedWin.href=top.selectedWin.href;
    eval("top.selectedWin"+winNo+".href=top.selectedWin"+winNo+".href;")
    }else{
    window.location.href=window.location.href;
    }

}

function refreshParent() {
    window.parent.location.href = window.parent.location.href;
}
function closeWindow() {
    $('.window' + numPanel).window('close');
   // window.location.href=window.location.href;
}